<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>vue实例</title>
  <script src="./js/vue2.js"></script>
</head>
<body>
  
  <div id="root">
    <div @click="handleClick">{{message}}</div>
    <item></item>
  </div>

</body>
</html>
<script>

  // 组件也是一个vue实例
  Vue.component('item', {
    template:'<div>hello item</div>'
  });

  // 使用vue实例接管 root 的标签
  var vm = new Vue({
    el:'#root',
    data: {
      message: 'hello world',
    },
    methods: {
      handleClick: function(){
        alert('点击事件');
      }
    }
  });
</script>